<?php

namespace App\Http\Requests\Logic\Study;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;

class StudyUpdateRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return Auth::user()->isManager();
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'pic'=>'required',
            'name'=>'required_if:type,1',
            'gender'=>'required_if:type,1',
            'age'=>'required_if:type,1',
            'height'=>'required_if:type,1',
            'position'=>'required_if:type,1',
            'work_time_begin'=>'required_if:type,1',
            'work_time_end'=>'required_if:type,1',
            'plate_number'=>'required_if:type,1',
            'mobile'=>'required_if:type,1',
            'desc'=>'required_if:type,1',
            'title'=>'required_if:type,2',
            'content'=>'required_if:ype,2',
        ];
    }
}
